<?php


namespace app\newapi\controller;


use app\newapi\logic\WapshopLogic;

class Wapshop extends \app\api\controller\Controller
{
    public function applyShop(){
        $param['name'] = $this->postData("name")?$this->postData("name"):"";
        $param['contacts'] = $this->postData("contacts")?$this->postData("contacts"):"";
        $param['contacts_tel'] = $this->postData("contacts_tel")?$this->postData("contacts_tel"):"";
        $param['province'] = $this->postData("province")?$this->postData("province"):"";
        $param['city'] = $this->postData("city")?$this->postData("city"):"";
        $param['district'] = $this->postData("district")?$this->postData("district"):"";
        $param['address'] = $this->postData("address")?$this->postData("address"):"";
        $param['reason'] = $this->postData("reason")?$this->postData("reason"):"";
        $param['uid'] = 1;
        $logic = new WapshopLogic();
        //验证数据
        $yz = $logic->judgeParam($param);
        if($yz['code']>0){
            $this->renderError($yz['meg']);
        }

        $res = $logic->addData($param);
        if($res){
            $this->renderSuccess("");
        }else{
            $this->renderError("申请失败");
        }
    }
}